<cfscript>    
    view = createObject("component", session.rootDir & ".views.layout");
    if( Session.Auth EQ True and (Session.strAuthType EQ Session.MANAGERS or Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR) ){
		view.init("Step 1:  Manager Termination Request",
			"/jquery/ui-1.8.5/jquery-ui.min.js,/jquery/plugins/scrollTo/jquery.scrollTo-1.4.2-min.js, /" & session.rootDir & "/static/js/SCF/Step1-Request.js",
			"/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css","Home",main, "Termination");
    }else{
        view.init("Denied","","","Home","Denied");
    }    
    view.html();
</cfscript>

<cffunction name="main" access="public" output="true" returntype="any">

    <cfscript>
        import models.*;
        FormAction = '/' & session.rootDir & '/controller/SubmitHandlerTermination.cfm?SCFStep1=add';
        FileDirectory = '/#session.TerminationDocuments#';
        KronosQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.Kronos");
        GetDepts = KronosQueries.funcGetDepts();
        GetSupDept = KronosQueries.funcGetSupDept(Session.HRID);
        CurrentEmployees = KronosQueries.funcGetCurrentEmployees();
        FileTypes = EntityLoad("FileTypes", {CategoryID = 2});        
        GetTermTypes = KronosQueries.funcGetPersonCodes('TT');
        GetES = KronosQueries.funcGetPersonCodes('ES');
        GetRC = KronosQueries.funcGetReasonCodes('ES');
    </cfscript>
    
    <cfquery name="GetEmpStatus" dbtype="query">
        Select * 
        From GetES
        Where PersonCodeIDNo in (-10133, -10132)
    </cfquery>
    
    <cfquery name="GetESReasonCodes" dbtype="query">
         Select * 
         From GetRC
        Where ReasonCodeIDNo not in (3,5,6,56)
    </cfquery>
    
    
    <cfoutput> 
    <h1 class="title">Step 1:  Termination Request</h1>
        <div class="entry">    
            Welcome, #Session.EmpInfo.FirstName# #Session.EmpInfo.LastName#.  
            In this step, we'll capture information necessary to initiate the request for termination of an employee: 
            <br /><br /> 

            <div class="notes">
                <table>
                    <tr>
                        <td valign="top">
                            NOTE:&nbsp;&nbsp;
                        </td>
                        <td>
                            This page is for SCF employees only.  
                            To process Non-SCF employees or individual contractors click <a href="/#Session.RootDir#/Termination/NonSCF/Step1-Request.cfm">here</a>.
                        </td>
                    </tr>
                </table>
            </div>            
            
            <cfform name="frmStep1" method="post" action="#FormAction#" enctype='multipart/form-data'>
            <table width = 100%>
                <tr>
                    <td width =20%>Employee:</td>
                    <td>
                        <cfselect name="RosettaID" >
                            <option value="-1"> </option>
                            <cfloop query="CurrentEmployees">                                
                                <option value="#CurrentEmployees.RosettaID#">#CurrentEmployees.LastName#, #CurrentEmployees.FirstName#</option>
                            </cfloop>
                        </cfselect>              
                    </td>
                </tr>
                <tr>
                    <td>Termination Type:</td>
                    <td>
                        <cfselect name="TermTypeID" query="GetTermTypes" tabindex="20" value="PersonCodeIDNo" display="PersonCode" selected="0" />
                    </td>
                </tr>
                <tr>
                    <td>Employee Status:</td>
                    <td>                        
                        <cfselect name="EmpStatusIDNo" query="GetEmpStatus" tabindex="30" value="PersonCodeIDNo" display="PersonCode" selected="-10133" />
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">Employment Status Reason:</td>
                    <td>                        
                        <cfselect name="EmpStatusReasonCode" query="GetESReasonCodes" tabindex="40" value="ReasonCodeIDNo" display="ReasonCode" selected="0" />
                    </td>
                </tr>
                
                <tr>
                    <td nowrap="nowrap" valign="top">Letter of Resignation:</td>
                    <td>
                        <cfinput type="file" name="FileUpload" error_message="Please specify the file to upload." style="width:100%"> 
                        <cfinput type="hidden" name="FileTypeID" value="8" /> <!--- Letter of Resignation is id 8 --->
                        <cfinput type="hidden" name="Directory" value="#FileDirectory#" />
                    </td>
                </tr>            
                
                <tr>
                    <td valign="top">Termination Date: <BR /></td>
                    <td>
                        <div id="DateOfTermination_datepicker"></div>
                        <cfinput type="hidden" name="Term" value="#dateformat(now(),'mm/dd/yyyy')#" />
                    </td>
                </tr>
                
                
                <TR>
                    <TD valign="top">Comments:</TD>
                    <TD colspan=3>
                        <cftextarea rows="2" tabindex="70" name="Comments" style="width:99%" value="" />
                    </TD>
                </TR>
                <tr>
                    <td>&nbsp;
                        
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="right">
                        <cfinput type="button" name="Submit" value="Next >>" tabindex="80">
                        <cfinput type="hidden" name="FormAction" value="#FormAction#">
                    </td>
                </tr>
            </table>
        </cfform>            
        </div>    
    </cfoutput>
    
</cffunction>